package com.boot.rxjava;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;
import org.reactivestreams.Subscription;

import java.util.concurrent.atomic.AtomicInteger;

public class RxJavaParallel {
    public static void main(String[] args) throws InterruptedException {
//        AtomicInteger batch = new AtomicInteger(0);
//        int availableProcessor = Runtime.getRuntime().availableProcessors();
//        Observable.range(0, 100).groupBy(i -> batch.getAndIncrement() % availableProcessor)
//                .flatMap(i -> i.subscribeOn(Schedulers.computation())
//                        .map(j -> j.toString())).subscribe(System.out::println,System.err::println,() -> System.out.println("completed"));
//        Thread.sleep(12000);



    }



}
